package controllers

import (
	"beluga/tools"

	"github.com/astaxie/beego"
)

//RingoJSON  json结构体测试
type RingoJSON struct {
	Name   string `json:"name"`
	Age    int    `json:"age"`
	Role   string `json:"role"`
	Passwd string `json:"passwd"`
}

//RingoController abc
type RingoController struct {
	beego.Controller
}

//Get 请求返回 json 数据
func (c *RingoController) Get() {
	//data, _ := json.Marshal(c)
	rr := &RingoJSON{}
	rr.Name = "ringo"
	rr.Age = 19
	rr.Role = "administrator"
	//data, _ := json.Marshal(rr)
	beego.Informational("abc")
	passwd := "katg1598"
	pw, _ := tools.PasswordEncode(passwd, "", 10000)
	rr.Passwd = pw
	c.Data["json"] = rr
	c.ServeJSON()
}
